package com.dabai.iot.core.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dabai.iot.core.dto.ServerSubscribeInput;
import com.dabai.iot.core.dto.ServerSubscribeQuery;
import com.dabai.iot.core.dto.ServerSubscribeUpdate;
import com.dabai.iot.core.entity.ServerSubscribeEntity;
import com.dabai.iot.core.vo.ServerSubscribeVO;
import lombok.NonNull;

import java.util.List;

/**
 * 服务端订阅 Service 接口
 *
 * @author kev1n
 */
public interface IServerSubscribeService extends IService<ServerSubscribeEntity> {

    /**
     * 新增
     */
    boolean addServerSubscribe(ServerSubscribeInput serverSubscribeInput);

    /**
     * 修改
     */
    boolean updateServerSubscribe(ServerSubscribeUpdate serverSubscribeUpdate);

    /**
     * 删除
     */
    boolean deleteServerSubscribe(@NonNull Long id);

    /**
     * 分页
     */
    IPage<ServerSubscribeVO> getServerSubscribePage(IPage<ServerSubscribeEntity> page, ServerSubscribeQuery subscribeQuery);

    /**
     * 根据消费组主键Id获取关联的订阅列表
     *
     * @param consumerId 消费组主键id
     */
    List<ServerSubscribeVO> getListByConsumerId(@NonNull Long consumerId);

    /**
     * 租户下订阅列表
     */
    List<ServerSubscribeVO> selectList(String tenantId);

    /**
     * 根据产品获取订阅
     */
    ServerSubscribeEntity getByProductId(@NonNull Long productId);

    /**
     * 根据产品获取订阅缓存
     */
    ServerSubscribeEntity getCacheByProductId(Long productId);

}
